package com.wyd.controller;

import com.wyd.common.Result;
import com.wyd.rabbitmq.domain.User;
import com.wyd.redis.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 各种中间件测试
 */
@Slf4j
@RestController
@RequestMapping("/data")
public class DataController {

    @Autowired
    private RedisUtils redisUtils;

    @RequestMapping(value="getRedisKey",method = RequestMethod.GET)
    public Result getRedisKey(@RequestParam(value="key") String key){
        log.info("收到消息内容：{}",key);
        return Result.success(redisUtils.getString(key));
    }

    @RequestMapping(value="setRedisKey",method = RequestMethod.GET)
    public Result setRedisKey(@RequestParam(value="key") String key,@RequestParam(value="value") String value){
        log.info("收到消息内容：key={},value={}",key,value);
        return Result.success(redisUtils.set(key,value));
    }



}
